/*
 * @Description: 加解密的方式
 * @Version: 1.0
 * @Autor: ziwei
 * @Date: 2021-09-17 14:24:58
 * @LastEditors: ziwei
 * @LastEditTime: 2021-09-17 14:40:29
 */
let secret = 3;
function encrypt(message){
   let buffer = Buffer.from(message);
   for(let i=0;i<buffer.length;i++){
      buffer[i] = buffer[i]+secret
   }
   return buffer.toString()
}

function decrypt(message){
  let buffer = Buffer.from(message)
  for(let i=0;i<buffer.length;i++){
    buffer[i]=buffer[i]-secret
  }
  return buffer.toString()
}

let message = 'abc';
let encryptMessage = encrypt(message);
console.log('encryptMessage', encryptMessage)
let encryptMessage2 = decrypt(encryptMessage);
console.log('decryptMessage', encryptMessage2)